class Solution {
    vector<vector<int> > ans;
    vector<int> cur;
    void run(int &n, int &k, int m, int last) {
        if (k==m) {
            ans.push_back(cur);
            return;
        }
        for (int i=last+1;i<=n;i++) {
            cur.push_back(i);
            run(n, k, m+1, i);
            cur.pop_back();
        }
    }
public:
    vector<vector<int> > combine(int n, int k) {
        ans.clear();
        cur.clear();
        run(n, k, 0, 0);
        return ans;
    }
};
